package Oracle;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;


public class Connector {
	private String url = "jdbc:oracle:thin:@localhost:1521:XE"; 
	private Properties props = new Properties();
	private Connection conn;
	
	public boolean setData(int name,int hp,int defense,int strenght,int speed, int range){
		props.setProperty("user", "IA");
        props.setProperty("password", "oracle");
      
        //creating connection to Oracle database using JDBC
        try {
			conn = DriverManager.getConnection(url,props);
			//creating PreparedStatement object to execute query

	        String sql ="insert into BOT2 values("+name+ ","+hp+ ","+defense+","+strenght+","+speed+","+range+")";
	        PreparedStatement preStatement = conn.prepareStatement(sql);
	    
	        ResultSet result = preStatement.executeQuery();
	        sql = "commit";
	        preStatement = conn.prepareStatement(sql);
	        result = preStatement.executeQuery();
	       conn.commit();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        
        return true;
	}


}
